Skip to content

Add voting, truth predictions, and difficulty ratings to the website#3589

Open
zond wants to merge 1 commit intogoogle-deepmind:mainfrom
zond:discussions-voting-webtest
Open

Add voting, truth predictions, and difficulty ratings to the website#3589
zond wants to merge 1 commit intogoogle-deepmind:mainfrom
zond:discussions-voting-webtest

Conversation

@zond
Copy link
Copy Markdown
Contributor

@zond zond commented Mar 17, 2026

Summary

Adds a GitHub Discussions-backed voting system to the Formal Conjectures website:

  • Like theorems (HEART reactions)
  • Predict true/false (THUMBS_UP/DOWN reactions)
  • Rate difficulty 0-9 (discussion comments)
  • Consent modal on first use explaining that all activity is public on GitHub
  • Discussion links on theorem detail pages (created lazily)
  • Sort by most liked, difficulty, or prediction on the browse page

All data is stored as native GitHub Discussions features — no separate database.

Architecture

  • Reads: App Engine proxy (formal-conjectures-web-worker) fetches discussions using GitHub App installation tokens
  • Writes: browser talks directly to GitHub GraphQL using the user's OAuth token
  • OAuth: callback routed through the proxy so one registered URL works for all forks
  • Proxy validates that requested repos are google-deepmind/formal-conjectures or forks of it
  • CORS allows any *.github.io origin automatically

What changed

  • site/src/js/voting.js — complete rewrite: GitHub Discussions backend, consent modal, truth predictions
  • site/src/js/theorem.js, browse.js — enable voting integration, new sort options
  • site/src/css/style.css — truth widget, consent modal, discussion link styles
  • site/src/templates/ — uncomment voting.js, add sort options
  • site/appengine/ — new App Engine proxy (replaces site/worker/ Cloudflare Worker)
  • site/build.js — accept pre-processed JSON from the live site
  • .github/workflows/build-and-docs.yml-webtest branch support, voting config injection

How to try it

The branch is deployed at https://zond.github.io/formal-conjectures/. Click any theorem, then try voting, predicting, or rating difficulty.

Zero-config for forkers

Branches ending in -webtest skip the expensive Lean build, download the conjectures JSON from the live site, and deploy to GitHub Pages. To try on your own fork:

  1. Enable GitHub Pages (Settings > Pages > GitHub Actions)
  2. Enable Discussions (Settings > General > Features)
  3. Install the GitHub App: https://github.com/apps/formal-conjectures-voting/installations/new
  4. Push a branch ending in -webtest

No GCP project, secrets, or tokens needed. See site/docs/voting.md for full details.

Test plan

  • Like/unlike a theorem, verify heart reaction appears on the GitHub Discussion
  • Predict true/false, verify thumbs reaction on the Discussion
  • Rate difficulty, verify comment appears on the Discussion
  • Consent modal appears on first interaction, not again after
  • OAuth login works via proxy callback bounce
  • Browse page sort options (most liked, difficulty, predictions) work
  • Discussion link appears and lazily creates discussion
  • Proxy rejects non-fork repos (returns 403)
  • Full Lean build on main is unaffected (voting config still injected)
  • Verify on a second fork to confirm zero-config flow

🤖 Generated with Claude Code

@google-cla
Copy link
Copy Markdown

google-cla bot commented Mar 17, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@zond zond force-pushed the discussions-voting-webtest branch 10 times, most recently from 6a9477a to e32fef5 Compare March 23, 2026 11:30
…ty ratings

Replace the Cloudflare Worker + KV voting backend with GitHub Discussions.
Likes are HEART reactions, truth predictions are THUMBS_UP/DOWN reactions,
difficulty ratings are discussion comments. A shared App Engine proxy at
formal-conjectures-web-worker.uc.r.appspot.com handles OAuth and anonymous
reads using GitHub App installation tokens.

Key changes:
- voting.js: complete rewrite for GitHub Discussions backend
- theorem.js/browse.js: enable voting integration and new sort options
- appengine/: new App Engine proxy (replaces site/worker/)
- build.js: accept pre-processed JSON from the live site
- Workflow: -webtest branches skip Lean build, download JSON, inject config
- Consent modal on first interaction explaining public nature of activity
- OAuth callback routed through proxy so one URL works for all forks

Interactive voting widgets are temporarily disabled; read-only discussion
data (vote counts, predictions, difficulty) is displayed via the proxy.
@zond zond force-pushed the discussions-voting-webtest branch from e32fef5 to 8530867 Compare March 23, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant